package StudyCode.summary.mydatetime;

import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ParsingTimestamp {
	public static void main(String[] args) {
		String input = "2019-11-11 08:80:40.325";

		String pattern = "yyyy-MM-dd HH:mm:ss.SSS";

		SimpleDateFormat sdf = new SimpleDateFormat(pattern);

		Date dt = sdf.parse(input, new ParsePosition(0));
		System.out.println(dt);

		Calendar cal = Calendar.getInstance();

		cal.setTime(dt);

		System.out.println("Hour:" + cal.get(Calendar.HOUR));
		System.out.println("Minute:" + cal.get(Calendar.MINUTE));
		System.out.println("Second:" + cal.get(Calendar.SECOND));
		System.out.println("Millisecond:" + cal.get(Calendar.MILLISECOND));

	}
}
